﻿//  -------------------- iSharePoint -------------------- //
// 
//  Company:	IT Complex, LLC
//  Project:	Smart.Common
//  File name:	MetaForm.cs
//  Developer:	Solomatov Igor
//  Created:	15.04.2012
// 
//  -------------------- iSharePoint -------------------- //

namespace Smart.Common.Forms
{
	/// <summary>
	/// Form metadata
	/// </summary>
	public class MetaForm : MetaFormContainer<MetaFormCtrl>
	{
		/// <summary>
		/// Form action rules
		/// </summary>
		public MetaFormRules Rules { get; set; }

		/// <summary>
		/// Form buttons tabs
		/// </summary>
		public MetaFormButtonTabs ButtonTabs { get; set; }

		/// <summary>
		/// Flag whether form changed
		/// </summary>
		public bool FormChanged { get; set; }

		/// <summary>
		/// Form metadata
		/// </summary>
		public MetaForm(string title, string name)
			: base(title, name)
		{
			Rules = new MetaFormRules();
		}

		public override void SetParent()
		{
			base.SetParent();

			if (ButtonTabs != null)
				ButtonTabs.Parent = this;

			foreach (var rule in Rules)
				rule.Parent = this;
		}
	}
}